(Quick Reference)
create-script
Purpose
The
create-script
command creates a new Grails executable script that can be run with the
grails
command from a terminal window.
Examples
The command:
grails create-script execute-report
Creates a script called
scripts/ExecuteReport.groovy
such as:
target('default': "The description of the script goes here!") {
doStuff()
}
target(doStuff: "The implementation task") {
// logic here
}
The command can then be run with:
Description
The command will translate lower case command names separated by hyphens into a valid Groovy camel-cased class name. For example
create-controller
would become a script called
scripts/CreateController.groovy
.
The script generated is a
Gant script which can use Gant's capabilities to depend on other scripts from Grails core. Refer to the section on
Command Line Scripting in the user guide.
Usage:
grails create-script [name]
Fired Events:
CreatedFile
- When the script has been created